$(function(){
    var details=$('#details');
    var params=Params();
    loginTest();
    starAssess('#describe');
    starAssess('#log');
    starAssess('#seller');
    changeHtml();








    function starFn(Event,num){
        Event.eq(num).addClass('on').prevAll().addClass('on');
        Event.eq(num).nextAll().removeClass('on');
    }
    /*点击评价*/
    function starAssess(Event){
        var star=$(Event).find('b');
        var index=0;
        star.click(function(){
            index=$(this).index();
            starFn(star,index);
        }).hover(function(){
            var _index=$(this).index();
            starFn(star,_index);
        },function(){
            starFn(star,index);
        })
    }
    /*选择页面ID*/
    function Params() {
        var result = {};
        var arr = location.search.replace(/^\?/, '').split(/\&/g);
        result.docName = location.pathname.match(/\/([a-zA-Z_]+)\.html$/)[1];
        result.hash = location.hash.replace(/^\#/, '');
        for (var i = 0, n = arr.length; i < n; i++) {
            var key = arr[i].split(/\=/)[0];
            result[key] = arr[i].split(/\=/)[1];
        }
        return result;
    }
    /*创建Html*/
    function changeHtml(){
        var id=params.id;
        var orderDatas=LsyStorage.getItem('orderList_'+id);
        var str='';
        str+=
            '<a href="pro_details.html?id='+orderDatas.id+'"><img src="'+orderDatas.imgSrc+'" alt="evaluate_1.png"></a>'
            +'<h3><a href="pro_details.html?id='+orderDatas.id+'">'+orderDatas.title+'</a></h3>'
            +'<span>¥<b>'+orderDatas.price+'</b></span>'
            +'<b>有货</b>'
            +'<s><b>'+orderDatas.price+'</b>元</s>';
        details.html(str);

    }
});
